.\" $Id: PAPI_thread_id.3,v 1.11 2004/09/30 17:35:09 london Exp $
.TH PAPI_thread_id 3 "September, 2004" "PAPI Programmer's Reference" "PAPI"

.SH NAME
PAPI_thread_id \- get the thread identifier of the current thread

.SH SYNOPSIS
.B C Interface
.nf
.B #include <papi.h>
.BI "unsigned long PAPI_thread_id(void);"
.fi
.B Fortran Interface
.nf
.B #include "fpapi.h"
.BI PAPIF_thread_id(C_INT\ id )
.fi

.SH DESCRIPTION
This function returns a valid thread identifier. It calls the function
registered with PAPI through a call to 
.B PAPI_thread_init().

.SH ARGUMENTS
None.

.SH RETURN VALUES
On success, this function returns
.B PAPI_OK.
 On error, a negative error value is returned.

.SH ERRORS
.TP
.B "PAPI_EMISC" 
is returned if there are no threads registered.
.TP
.B "-1"
is returned if the thread id function returns an error.

.SH EXAMPLE
.nf
.if t .ft CW
unsigned long tid;

if ((tid = PAPI_thread_id()) == (unsigned long int)-1)
  exit(1);

printf("Initial thread id is: %lu\en",tid);
.if t .ft P
.fi

.SH BUGS
This function has no known bugs.

.SH SEE ALSO
.BR PAPI_thread_init "(3) " 
